home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / include / user / sysStats.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-23  |  13.4 KB  |  334 lines

  1. /*
  2.  * sysStat.h --
  3.  *
  4.  *    User-level definitions of routines and types for system statistics
  5.  *    returned by the Sys_Stats system call.  Instead of a /dev/kmem
  6.  *    type interface, we have calls to return specific kernel structure.
  7.  *    The kernel call takes the following arguments:
  8.  *    Sys_Stats(command, option, argPtr)
  9.  *    commands are defined below, and option and argPtr are interpreted
  10.  *    differently by each command.  Typically argPtr is a buffer that
  11.  *    gets filled in with a system structure, and option is used to
  12.  *    indicate the size, or to control tracing, or isn't used at all.
  13.  *
  14.  * Copyright 1986, 1988 Regents of the University of California
  15.  * Permission to use, copy, modify, and distribute this
  16.  * software and its documentation for any purpose and without
  17.  * fee is hereby granted, provided that the above copyright
  18.  * notice appear in all copies.  The University of California
  19.  * makes no representations about the suitability of this
  20.  * software for any purpose.  It is provided "as is" without
  21.  * express or implied warranty.
  22.  *
  23.  * $Header: /user5/kupfer/spriteserver/include/user/RCS/sysStats.h,v 1.5 92/06/23 12:19:43 kupfer Exp $ SPRITE (Berkeley)
  24.  *
  25.  */
  26.  
  27. #ifndef _SYSSTATS
  28. #define _SYSSTATS
  29.  
  30. /*
  31.  * Commands for the Sys_Stats system call.
  32.  *    SYS_RPC_CLT_STATS - Return the Rpc_CltStats structure that contains
  33.  *        client-side statistics for the RPC system. (see rpc.h)
  34.  *    SYS_RPC_SRV_STATS - Return the Rpc_SrvStats structure that contains
  35.  *        server-side statistics for the RPC system. (see rpc.h)
  36.  *    SYS_SYNC_STATS - Return the Sync_Instrument structure which
  37.  *        contains lock and wakeup counts. (see kernel/sync.h)
  38.  *    SYS_SCHED_STATS - Return the Sched_Instrument structure which
  39.  *        contains idle time and context switch counts (kernel/sched.h)
  40.  *    SYS_VM_STATS - Return the Vm_Stat structure which contains every
  41.  *        concievable VM statistic, fault counts etc. (kernel/vmStat.h)
  42.  *    SYS_RPC_TRACE_STATS - Used to both return the trace of recent RPCs,
  43.  *        and to enable/disable the trace, see options below.
  44.  *    SYS_FS_PREFIX_STATS - Return entries from the prefix table. (see fs.h)
  45.  *    SYS_PROC_TRACE_STATS - Used to both return the process migration
  46.  *        trace, and to enable/disable the trace, see options below.
  47.  *    SYS_SYS_CALL_STATS - Return the array of system call counters.
  48.  *        option indicates how many integers the buffer argPtr contains.
  49.  *    SYS_RPC_SERVER_HIST - Return the service time histogram for the RPC
  50.  *        indicated by option. (see kernel/rpcHistogram.h)  If option
  51.  *        is less than or equal to zero the histogram is cleared.
  52.  *    SYS_RPC_CLIENT_HIST - Return service time as obseved by a client.
  53.  *    SYS_NET_GET_ROUTE - Return the route table entry for a particular host.
  54.  *        The data returned are three integers: flags, spriteID, and
  55.  *        route type.  This is then followed by type specific data,
  56.  *        either an ethernet address or an internet address.
  57.  *    SYS_RPC_SRV_STATE - Return the RpcServerState structure for the
  58.  *        RPC server indexed by option.  (see kernel/rpcServer.h)
  59.  *    SYS_RPC_CLT_STATE - Return the RpcClientState structure for the
  60.  *        RPC client channel indexed by option.  (see kernel/rpcClient.h)
  61.  *    SYS_NET_ETHER_STATS - Return the Net_EtherStats structure which
  62.  *        contains interface statistics.  (see kernel/net.h)
  63.  *    SYS_RPC_ENABLE_SERVICE - Enable/disable the service side of the RPC
  64.  *        system.  A non-zero option value enables, zero disables.
  65.  *    SYS_GET_VERSION_STRING - Return the kernel version string.  option
  66.  *        indicates how big the users buffer is.
  67.  *    SYS_PROC_MIGRATION - Enable/Disable process migration to this host.
  68.  *        See options defined below.
  69.  *    SYS_DISK_STATS - Return the Sys_DiskStats structure defined below.
  70.  *        option corresponds to a kernel controller table index.
  71.  *    SYS_FS_PREFIX_EXPORT - Return the export list of a prefix.  The
  72.  *        option parameter indicates the size of the buffer argPtr.
  73.  *        argPtr should contain the prefix upon entry, and is
  74.  *        overwritten with an integer array of SpriteIDs that
  75.  *        corresponds to the export list for the prefix.
  76.  *    SYS_LOCK_STATS - Return the locking statistics. option indicates the
  77.  *        size of the buffer in units of Sync_LockStat structures.
  78.  *    SYS_RPC_SRV_COUNTS - Return the count of RPC service calls.  The
  79.  *        option argument is unused.  If argPtr == NULL then the
  80.  *        counts are printed on the console, otherwise it should be
  81.  *        the address of an integer array size RPC_LAST_COMMAND+1
  82.  *    SYS_RPC_CALL_COUNTS - Return the count of RPC calls.  The
  83.  *        option argument is unused.  If argPtr == NULL then the
  84.  *        counts are printed on the console, otherwise it should be
  85.  *        the address of an integer array size RPC_LAST_COMMAND+1
  86.  *    SYS_LOCK_RESET_STATS - Reset the locking statistics.
  87.  *    SYS_INST_COUNTS - Return information from instruction counts. This
  88.  *        only works on special spur kernels.
  89.  *    SYS_RESET_INST_COUNTS - Reset instruction counts.
  90.  *    SYS_RECOV_STATS - Return information about the recov module.
  91.  *    SYS_RECOV_PRINT - Change printing level of recov module traces.
  92.  *    SYS_FS_RECOV_INFO - Return info with names about the state of
  93.  *        files for recovery testing.
  94.  *    SYS_RECOV_CLIENT_INFO - Dump state on server about per-client recovery.
  95.  *    SYS_RPC_SERVER_TRACE - Turn tracing of rpc servers on or off.
  96.  *    SYS_RPC_SERVER_INFO - Return rpc server tracing info to user.
  97.  *    SYS_RPC_SERVER_FREE - Free up space used by rpc server tracing.
  98.  *    SYS_RPC_SET_MAX - Set the maximum number of server processes.
  99.  *    SYS_RPC_SET_NUM - Create enough server processes to have this many.
  100.  *    SYS_RPC_NEG_ACKS - Turn on or off negative acks on the server.
  101.  *    SYS_RPC_CHANNEL_NEG_ACKS -  Set client policy on or off for handling
  102.  *        neg acks by ramping down the number of client channels.
  103.  *    SYS_RECOV_ABS_PINGS - Whether to use absolute ping intervals or not.
  104.  *    SYS_RECOV_PRINT - Set the recovery print level.
  105.  *    SYS_RPC_NUM_NACK_BUFS - Set the number of negative acknowledgement
  106.  *        buffers.
  107.  *    SYS_START_STATS - Turn on the kernel's periodic printing of sched
  108.  *        and io stats.  TEMPORARY for recovery measurements.
  109.  *    SYS_END_STATS - Turn off the kernel's periodic printing of sched
  110.  *        and io stats.  TEMPORARY for recovery measurements.
  111.  *    SYS_TRACELOG_STATS - Trace log buffer commands (for SOSP91 paper).
  112.  *      SYS_DEV_CHANGE_SCSI_DEBUG - Change debug level for scsi driver.
  113.  *      SYS_SYS_CALL_STATS_ENABLE - Turn on or off system call profiling.
  114.  *      SYS_PROC_SERVERPROC_TIMES - Display the instrumentation for 
  115.  *          Proc_ServerProcs. 
  116.  *    SYS_NET_GEN_STATS - Return the Net_GenStats structure which 
  117.  *            contains generic instrumentation about a network interface.
  118.  *    SYS_RPC_SANITY_CHECK - Toggle sanity checks on rpc packets.
  119.  *    SYS_FS_EXTRA_STATS - Extra fs stats that should go into fsStats for
  120.  *                the next global compile.
  121.  */
  122.  
  123. #define SYS_RPC_CLT_STATS    1
  124. #define SYS_RPC_SRV_STATS    2
  125. #define SYS_SYNC_STATS        3
  126. #define SYS_SCHED_STATS        4
  127. #define SYS_VM_STATS        5
  128. #define SYS_RPC_TRACE_STATS    6
  129. #define SYS_FS_PREFIX_STATS    7
  130. #define SYS_PROC_TRACE_STATS    8
  131. #define SYS_SYS_CALL_STATS    9
  132. #define SYS_RPC_SERVER_HIST    10
  133. #define SYS_RPC_CLIENT_HIST    11
  134. #define SYS_NET_GET_ROUTE    12
  135. #define SYS_RPC_SRV_STATE    13
  136. #define SYS_RPC_CLT_STATE    14
  137. #define    SYS_NET_ETHER_STATS    15
  138. #define SYS_RPC_ENABLE_SERVICE    16
  139. #define SYS_GET_VERSION_STRING    17
  140. #define SYS_PROC_MIGRATION    18
  141. #define    SYS_DISK_STATS        19
  142. #define SYS_FS_PREFIX_EXPORT    20
  143. #define SYS_LOCK_STATS        21
  144. #define SYS_RPC_SRV_COUNTS    22
  145. #define SYS_RPC_CALL_COUNTS    23
  146. #define SYS_LOCK_RESET_STATS    24
  147. #define SYS_INST_COUNTS        25
  148. #define SYS_RESET_INST_COUNTS    26
  149. #define SYS_RECOV_STATS        27
  150. #define SYS_FS_RECOV_INFO    28
  151. #define    SYS_RECOV_CLIENT_INFO    29
  152. #define    SYS_RPC_SERVER_TRACE     30
  153. #define    SYS_RPC_SERVER_INFO    31
  154. #define    SYS_RPC_SERVER_FREE    32
  155. #define    SYS_RPC_SET_MAX        33
  156. #define    SYS_RPC_SET_NUM        34
  157. #define    SYS_RPC_NEG_ACKS    35
  158. #define    SYS_RPC_CHANNEL_NEG_ACKS    36
  159. #define SYS_RECOV_ABS_PINGS    37
  160. #define SYS_RECOV_PRINT        38
  161. #define    SYS_RPC_NUM_NACK_BUFS    39
  162. #define    SYS_TRACELOG_STATS    40
  163. #define SYS_START_STATS        100
  164. #define SYS_END_STATS        101
  165. #define SYS_DEV_CHANGE_SCSI_DEBUG 102
  166. #define SYS_SYS_CALL_STATS_ENABLE 103
  167. #define SYS_PROC_SERVERPROC_TIMES 104
  168. #define SYS_NET_GEN_STATS    105
  169. #define SYS_RPC_SANITY_CHECK    107
  170. #define SYS_FS_EXTRA_STATS    108
  171.  
  172.  
  173. /*
  174.  * Options for the Sys_Stats SYS_RPC_TRACE_STATS command.  If the option
  175.  * is a positive value then that number of trace records are returned
  176.  * into the buffer referenced by argPtr.
  177.  */
  178. #define SYS_RPC_TRACING_PRINT    -1
  179. #define SYS_RPC_TRACING_OFF    -2
  180. #define SYS_RPC_TRACING_ON    -3
  181.  
  182. /*
  183.  * Options for the Sys_Stats SYS_PROC_TRACE_STATS command.  Use these
  184.  * values for the option argument to the Test_Stats call when using
  185.  * the PROC_TRACE_STATS command.  Any argument greater than the
  186.  * largest positive defined constant is the number of trace records to
  187.  * copy into the output buffer (i.e., it is not permissible to copy
  188.  * only 1-3 records).
  189.  */
  190. #define SYS_PROC_TRACING_PRINT    1
  191. #define SYS_PROC_TRACING_OFF    2
  192. #define SYS_PROC_TRACING_ON    3
  193.  
  194. /*
  195.  * Options for the Sys_Stats SYS_PROC_MIGRATION command.
  196.  * ALLOW, REFUSE, and GET_STATUS are obsoleted by GET_STATE and SET_STATE.
  197.  *
  198.  *   SYS_PROC_MIG_ALLOW        - allow all migrations to this machine.
  199.  *   SYS_PROC_MIG_REFUSE    - refuse all migrations to this machine.
  200.  *   SYS_PROC_MIG_GET_STATUS    - get whether all migrations are allowed
  201.  *                  or refused.
  202.  *   SYS_PROC_MIG_SET_DEBUG    - set the migration debug level.
  203.  *   SYS_PROC_MIG_GET_VERSION    - get the migration version.
  204.  *   SYS_PROC_MIG_GET_STATE    - get the general migration state.
  205.  *   SYS_PROC_MIG_SET_STATE    - set it.
  206.  *   SYS_PROC_MIG_SET_VERSION    - set the migration version.
  207.  *   SYS_PROC_MIG_GET_STATS    - get statistics.
  208.  *   SYS_PROC_MIG_RESET_STATS    - reset statistics.
  209.  */
  210. #define SYS_PROC_MIG_ALLOW        0
  211. #define SYS_PROC_MIG_REFUSE        1
  212. #define SYS_PROC_MIG_GET_STATUS        2
  213. #define SYS_PROC_MIG_SET_DEBUG        3
  214. #define SYS_PROC_MIG_GET_VERSION    4
  215. #define SYS_PROC_MIG_GET_STATE        5
  216. #define SYS_PROC_MIG_SET_STATE        6
  217. #define SYS_PROC_MIG_SET_VERSION    7
  218. #define SYS_PROC_MIG_GET_STATS        8
  219. #define SYS_PROC_MIG_RESET_STATS    9
  220.  
  221. /*
  222.  * Options for SYS_TRACELOG_STATS.
  223.  */
  224. #define SYS_TRACELOG_ON        1
  225. #define SYS_TRACELOG_OFF    2
  226. #define SYS_TRACELOG_DUMP    3
  227. #define SYS_TRACELOG_RESET    4
  228. /* 
  229.  * Structure to return SYS_TRACELOG_STATS.
  230.  */
  231. typedef struct Sys_TracelogRecord {
  232.     int        recordLen;    /* Size of this record in bytes. */
  233.     int        time[2];    /* (Timer_Ticks) Timestamp. */
  234.     ClientData    data;        /* Arbitrarily long data. */
  235. } Sys_TracelogRecord;
  236.  
  237. #define SYS_TRACELOG_KERNELLEN 32
  238. #define SYS_TRACELOG_TYPELEN 8
  239. /*
  240.  * This is the header we write to the user level file.
  241.  * Note: things are in somewhat of a state of flux.  The current status is:
  242.  * File is stored as:
  243.  *   magic #
  244.  *   Sys_TracelogHeader
  245.  *   A bunch of records
  246.  * The fields: numBytes, numRecs, and lostRecords are not used.
  247.  * The traceDir is filled in by the user-level dump program.
  248.  * Lost records are indicated by a special record type in the file.
  249.  * The reason for this format is that it is inconvenient to have the length
  250.  * in the header, since any routine post-processing data and writing a
  251.  * new file would have to go back and modify the header after it knew
  252.  * how many records it had.  This way, you write out a fixed header and
  253.  * then whatever records you want.
  254.  */
  255. typedef struct Sys_TracelogHeader {
  256.     int        numBytes;    /* Total size of the records in bytes. */
  257.                 /* Flags are stored in the high 2 bytes. */
  258.     int        numRecs;    /* Number of records. */
  259.     int        machineID;    /* ID of this machine. */
  260.     char    kernel[SYS_TRACELOG_KERNELLEN];    /* Kernel we're running. */
  261.     char    machineType[SYS_TRACELOG_TYPELEN]; /* Machine type. */
  262.     int        bootTime[2];    /* Time of boot (to convert of trace time. */
  263.     int        lostRecords;    /* Records lost from overflow. */
  264.     int        traceDir[4];    /* FileID of the trace directory. */
  265. } Sys_TracelogHeader;
  266.  
  267. /*
  268.  * This is the structure returned by the kernel.
  269.  */
  270. typedef struct Sys_TracelogHeaderKern {
  271.     int        numBytes;    /* Total size of the records in bytes. */
  272.                 /* Flags are stored in the high 2 bytes. */
  273.     int        numRecs;    /* Number of records. */
  274.     int        machineID;    /* ID of this machine. */
  275.     char    kernel[SYS_TRACELOG_KERNELLEN];    /* Kernel we're running. */
  276.     char    machineType[SYS_TRACELOG_TYPELEN]; /* Machine type. */
  277.     int        bootTime[2];    /* Time of boot (to convert of trace time. */
  278.     int        lostRecords;    /* Records lost from overflow. */
  279. } Sys_TracelogHeaderKern;
  280.  
  281. #define LOST_TYPE 128
  282.  
  283. #define TRACELOG_FLAGMASK 0xf0000000
  284. #define TRACELOG_TYPEMASK 0x0fff0000
  285. #define TRACELOG_BYTEMASK 0x0000ffff
  286.  
  287. #define TRACELOG_MAGIC 0x44554d50
  288. #define TRACELOG_MAGIC2 0x44554d51
  289.  
  290. /*
  291.  * Structure to return for disk stats.
  292.  */
  293. #define    SYS_DISK_NAME_LENGTH    100
  294. typedef struct Sys_DiskStats {
  295.     char    name[SYS_DISK_NAME_LENGTH];    /* Type of disk. */
  296.     int        controllerID;            /* Which controller it is. */
  297.     int        numSamples;            /* Number of times idle time
  298.                          * was sampled. */
  299.     int        idleCount;            /* Number of times disk was
  300.                          * idle when sampled. */
  301.     int        diskReads;            /* The number of sector reads 
  302.                          * from this disk. */
  303.     int        diskWrites;            /* The number of sector writes
  304.                          * from this disk. */
  305. } Sys_DiskStats;
  306.  
  307. #ifdef SOSP91
  308.  
  309. #include <spriteTime.h>
  310.  
  311. typedef    struct    Sys_SchedOverallTimes {
  312.     Time    kernelTime;
  313.     Time    userTime;
  314.     Time    userTimeMigrated;
  315. } Sys_SchedOverallTimes;
  316.  
  317. /*
  318.  * Statistics for name lookup on client.
  319.  */
  320. typedef struct Sys_SospNameStats {
  321.     Time    totalNameTime;
  322.     Time    nameTime;
  323.     Time    prefixTime;
  324.     Time    miscTime;
  325.     int        numPrefixLookups;
  326.     int        numComponents;
  327.     int        numPrefixComponents;
  328. } Sys_SospNameStats;
  329. #endif SOSP91
  330.  
  331. extern ReturnStatus        Sys_Stats();
  332.  
  333. #endif /* _SYSSTATS */
  334.